<?php if (!defined('THINK_PATH')) exit();?><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<link rel="stylesheet" type="text/css" href="/Public/Css/wx_main.css">
<link rel="stylesheet" type="text/css" href="/Public/Css/wx_baidu.css">
<script type="text/javascript" src="/Public/Js/jquery.min.js"></script>
<script src="/Public/xl/mobiscroll.core-2.5.2.js" type="text/javascript"></script>
<script src="/Public/xl/mobiscroll.core-2.5.2-zh.js" type="text/javascript"></script>
<link href="/Public/xl/mobiscroll.core-2.5.2.css" rel="stylesheet" type="text/css">
<script src="/Public/xl/mobiscroll.datetime-2.5.1.js" type="text/javascript"></script>
<script src="/Public/xl/mobiscroll.datetime-2.5.1-zh.js" type="text/javascript"></script>
<script src="/Public/xl/mobiscroll.android-ics-2.5.2.js" type="text/javascript"></script>
<link href="/Public/xl/mobiscroll.android-ics-2.5.2.css" rel="stylesheet" type="text/css">
<title>约车</title>

<script>
$(function () {
	var currYear = (new Date()).getFullYear();	
	var opt={};
	opt.date = {preset : 'datetime'};
	//opt.time = {preset : 'time'};
	opt.default = {
		theme: 'android-ics light', //皮肤样式
		display: 'bottom', //显示方式 
		mode: 'scroller', //日期选择模式
		lang:'zh',
		startYear:currYear, //开始年份
		endYear:currYear //结束年份
	};
		$("#appDate").scroller('destroy').scroller($.extend(opt['date'], opt['default']));
		//var optDateTime = $.extend(opt['datetime'], opt['default']);
	//var optTime = $.extend(opt['time'], opt['default']);
	//$("#appTime").mobiscroll(optTime).time(optTime);
});

function getAppTime2(){
	var appDate = $('#appDate');
	if(appDate.val() == ''){
		appDate.val('请选择预约时间!!!');
	}else{
		var obj = new Array();
		var time = appDate.val();
		obj = time.split(' ');
		obj2 = obj[1].split(':');
		
		if(obj2[0] >= 21 || obj2[0] < 5){
			$('.nextOne3').hide();
			error('预约21点至凌晨5点之间车辆请联系客服');
		}else{
			$('#errorDiv').hide();
			$('.nextOne3').show();
		}
		appDate.val(appDate.val() +'~'+ (parseInt(obj2[0])+1)+':'+obj2[1]);		
	}
}

function getPrice(){
  var appDate = $('#appDate').val();
  var from_city = $("#from_city").val();
  var to_city = $("#end_city").val();
  var adultsnum = $('#adultsnum').val();
  var kidsnum   = $('#kidsnum').val();


  $.ajax({
    type: "GET",
    url: "/index.php?s=/index/getdyprice",
    data: {from_city:from_city, to_city:to_city, adultsnum:adultsnum},
    //dataType: "json",
    success:function(data){
      $('#totalprice').html(data+'&nbsp;元');
         $('#price').val(data);
      
   
    }
  });}
function error(msg){
	$('#errorDiv').css('display','block');
	$('#error').html(msg);
}
function checkForm(type){
	var appDate = $('#appDate').val();
        var price=$('#price').val();
	var from_address = $('#start').val();
	var to_address = $('#end').val();
	var adultsnum=$('#adultsnum').val();
        var kidsnum=$('#kidsnum').val();
        var price=$('#price').val();
        var crc=$('#crc').val();
        var xingming=$('#xingming').val();
        var tel=$('#tel').val();
  ;
	if(appDate ===''){
		error('请选择您的预约时间');  
		return false;
	}
	else if(from_address ===''){
		error('请选择您的出发地址');  
		return false;
	}
	else if(to_address ===''){
		error('请选择您的到达地址');  
		return false;
	}else if(adultsnum ===''){
            error('请输入行程人数');  
		return false;
            
        }
       else if(price ==='' || price==='0'){
        
                 error('此线路没有开通');  
		return false;   
    }  
else{
    $.ajax({
    type: "POST",
    url: "/index.php?s=/index/addxc/fq/2",
    data: {start:from_address, end:to_address, price:price,adultsnum:adultsnum, kidsnum:kidsnum,starttime:appDate,crc:crc,xingming:xingming,tel:tel},
   
    success:function(data){
   if(data === '0'){
     window.location.href="/index.php?s=/index/yy/id/1.html" ; 
       
   } else if(data ==='1'){
       alert("未知错误");
       
   }
   
    }
  });
    
}
	


	
	return false; 
}

</script>
</head>
<body style="text-align:center;" onload="getPrice()">

<div class="topSearch" style="z-index: 10;position: relative;font-size:2em;">
<a onclick="window.history.back()" href="javascript:void(0);"><img src="/Public/images/orderlog_03.png"></a>马上约车</div>
<form id="detailform" action="/index.php/Orders/addOrderdone" method="post">
<div class="inputDiv"><img src="/Public/images/time.png"><input type="text" name="starttime" id="appDate" onchange="getAppTime2()" value="" readonly="" class="font1" placeholder="预约时间"></div>
<div class="inputDiv"><img src="/Public/images/qi.png"><input type="text" name="start" id="start" class="font1" value="<?php echo ($start); ?>" placeholder="从哪儿出发" readonly="readonly"></a></div>
<div class="inputDiv"><img src="/Public/images/zhong.png"><input type="text" name="end" id="end" class="font1" value="<?php echo ($end); ?>" placeholder="到哪儿去" readonly="readonly"></a></div>
<div class="inputDiv"><span style="size:13px;">姓名</span><input type="txt" name="xingming" id="xingming" class="font1" value="" placeholder="收货人姓名">&nbsp;</div>
<div class="inputDiv"><span>电话</span><input type="text" name="tel" id="tel" class="font1" placeholder="收货人电话"></div>
<div class="inputDiv"><span>备注</span><input type="text" name="crc" id="crc" class="font1" placeholder="备注"></div>
<div class="inputDiv" id="errorDiv" style="display:none;margin-top:0;"><div id="error" style="line-height:30px;color:#f00;text-align:center;font-size:1.4em;"></div></div>

<div id="totalPirce"></div>
<input type="hidden" value="" name="price" id="price">
<input type="hidden" value="<?php echo ($from_city); ?>" name="from_city" id="from_city">
<input type="hidden" value="<?php echo ($end_city); ?>" name="end_city" id="end_city">
<div class="nextOne3" onclick="checkForm(1)">预约司机</div>
<div class="inputDiv">
	<ul class="shuoming">
    <li>预约说明：</li>
    <li>1、林州市区，新郑机场，郑州三环以内免费接送，超出范围需支付相应燃油费。</li>
    <li>2、为确保及时安排车辆，建议您提前2小时预约。</li>
    <li>3、如有疑问请致电0372-6659666  /  03726659888。</li>
	</ul>
</div>
</form>
<div class="jiazai"><img class="jiazai_img" src="/Public/images/jiazai.gif"></div>

</body></html>